// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import 'animate.css';

import { setCookie,setCookie2, getCookie, checkCookie, clearCookie } from '@/utils/cookie';

import '@/utils/rem'


Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(mavonEditor)

Vue.prototype.$setCookie = setCookie;
Vue.prototype.$setCookie2 = setCookie2;
Vue.prototype.$getCookie = getCookie;
Vue.prototype.$checkCookie = checkCookie;
Vue.prototype.$clearCookie = clearCookie;

var axios = require('axios')
Vue.prototype.$axios = axios

// 引入高亮
import hljs from 'highlight.js'
import 'highlight.js/styles/googlecode.css'
// 注册指令
Vue.directive('highlight', function (el) {
    let blocks = el.querySelectorAll('pre code')
    blocks.forEach((block) => {
        hljs.highlightBlock(block)
    })
})


// window.onresize = setHtmlFontSize;
// function setHtmlFontSize(){
//     const htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
//     const htmlDom = document.getElementsByTagName('html')[0];
//     htmlDom.style.fontSize = htmlWidth / 10 + 'px';
// };
// setHtmlFontSize();

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
